package com.dominator.api.utils.api;


import com.dominator.api.enums.ReqEnums;
import com.dominator.api.utils.encode.Des3Utils;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 响应json数据用的公共类
 *
 * @author Administrator
 *
 */
@Data
@NoArgsConstructor
public class ApiMessage implements Serializable{
    String code;
    String message;
    String data;



    public ApiMessage(String _code, String _message) {
        this.code = _code;
        this.message = _message;
    }

    public ApiMessage(String _code, String _message, Object _object) {
        this.code = _code;
        this.message = _message;
        if (_object !=null){
            this.data = Des3Utils.encResponse(_object);
        }
    }


    public ApiMessage(ReqEnums reqEnums){
        this.code=reqEnums.getCode();
        this.message=reqEnums.getMsg();
    }

    public ApiMessage(ReqEnums reqEnums,Object object){
        this.code=reqEnums.getCode();
        this.message=reqEnums.getMsg();
        if (object !=null){
            this.data =Des3Utils.encResponse(object);
        }
    }



}
